import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/Rx';
import { HTTP_SERVER_URL, getToken } from '../../app/app.contant';
import 'rxjs/add/operator/map';

@Injectable()
export class HomeService {
    constructor(private http: HttpClient) { }

    /** 获取采购计划 */
    listProcurementPlan() {
        return this.http.get(HTTP_SERVER_URL + 'home/law/material/listtasks?_d_='+new Date()+'&token='+getToken(), { observe: 'response' })
            .map((resp) => resp.body['data'])
            .catch((error: any) => Observable.throw(error || 'Server error'));
    }

}